@echo off
if exist %~sdp0.tmp.txt del %~sdp0.tmp.txt
:loop1
set /p smcUrl=Enter IP of SMC service address(for example:192.168.0.1):
if "%smcUrl%"=="" goto loop1

:loop2
set /p userName_smc=Enter userName:
if "%userName_smc%"=="" goto loop2

:loop3
powershell -Command $pword = read-host "Enter password" -AsSecureString ; ^
    $BSTR=[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pword) ; ^
        [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR) > .tmp.txt 
set /p password_smc=<.tmp.txt  & del .tmp.txt

echo.

java -cp *;lib/* com.huawei.esdk.tpoa.tools.action.CreateScript %smcUrl% %userName_smc% %password_smc% %userdomain%
if exist %~sdp0TempScript.ps1 (
if exist %ExchangeInstallPath%bin\exshell.Psc1 (
echo Begin to execute PS1 file...
echo The program is executing, please wait a moment, don't close the window.
PowerShell.exe -PSConsoleFile "%ExchangeInstallPath%bin\exshell.Psc1" -Command ". '%~sdp0TempScript.ps1'" >Exchange_Management_Shell_Log.txt
java -cp *;lib/* com.huawei.esdk.tpoa.tools.action.LogAnalysis "Exchange_Management_Shell_Log.txt"
)
del %~sdp0TempScript.ps1
)
pause
exit